Functions

Slides: OpenOffice PowerPoint
Reading: HFJS Ch. 6

Tools

JavaScript helper functions for cookie handling: cookie.js

XHTML to PDF translator: Prince 8.0 download.

Homework

Preliminary project pages due last Tuesday. Preliminary summary.pdf files due today.

Demonstration

Modify the convert.html page from last week to converts arbitrary decimal integers to hexidecimal Strings.
  1. Respond to changes in the decimal field.
  2. Complain, if the user enters something that is not a number.
  3. Create a function to convert integers from 0 to 15 to a hexidecimal character.
  4. Repeatedly,
    • take the remainder of the input integer mod 16,
    • convert this remainder to a hexidecimal character,
    • prepend this character to a result string that starts off being empty, and
    • divide the input by 16,
    as long as the input is greater than zero.
  5. Prepend the characters 0x to your result String
  6. Display your result in the hexidecimal field
  7. Handle zero input correctly.
  8. Handle negative decimal input correctly.

Lab

Always shut down your computer and turn off your display before leaving the lab.